﻿package lobby.exchangeddata
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import lobby.events.LobbyEvent;
	import lobby.constants.ConstData;
	
	/**
	 * ...
	 * @author Doan Nguyen Thuy Nha Truc (Bamboo)
	 */
	public class HistoryInfoSicbo extends HistoryInfoBase
	{
		public function HistoryInfoSicbo()
		{
			this.gameTypeIndex = 7;
		}
		
		public override function returnSetHistory(result:String):Array
		{
			trace("Sicbo:" + result)
			var MAX_NUM_CHECKERS:Number = 66;
			super.setOdlResult = result;
			var resultArr:Array = new Array();
			
			var numBetResult = parseInt(result.substr(ConstData.POS_HIS_RESULT, 3), 10);
			result = result.substr(ConstData.POS_HIS_RESULT, 3 + (2 * numBetResult));
			
			trace("Sicbo:" + result, numBetResult)
			var sNumResult = parseInt(result.substr(0, 3), 10);
			var sTmp = result.substr(3, result.length);
			
			if (sNumResult > MAX_NUM_CHECKERS)
			{
				sTmp = sTmp.substr((sNumResult - MAX_NUM_CHECKERS) * 2, (MAX_NUM_CHECKERS * 2));
			}
			trace("Sicboresult:" + sTmp)
			var temp:Object;
			while (sTmp.length >= 2)
			{
				
				temp = sTmp.slice(0, 2);
				resultArr.push(temp);
				sTmp = sTmp.slice(2, sTmp.length);
			}
			
			return resultArr;
		}
	}

}